dhcpv4: remove one more variable from dhcpv4_handle_msg()
authorDavid Härdeman <[email protected]>
Mon, 6 Oct 2025 08:47:35 +0000 (10:47 +0200)
committerÁlvaro Fernández Rojas <[email protected]>
Tue, 21 Oct 2025 17:04:51 +0000 (19:04 +0200)
It's only used once, and there's no lack of variables to keep track of in
dhcpv4_handle_msg().

Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/278
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/dhcpv4.c

index d1d975bda8f8d62d47c7aa0de7e50b99aea56ceb..1a84d30c95e1c81372644e0e5117ca0a09bfaf61 100644 (file)
@@ -628,7 +628,6 @@ void dhcpv4_handle_msg(void *src_addr, void *data, size_t len,
                send_reply_cb_t send_reply, void *opaque)
 {
        struct dhcpv4_message *req = data;
-       int sock = iface->dhcpv4_event.uloop.fd;
        struct sockaddr_in dest_addr;
        struct dhcpv4_message reply = {
                .op = DHCPV4_OP_BOOTREPLY,
@@ -862,7 +861,7 @@ void dhcpv4_handle_msg(void *src_addr, void *data, size_t len,
        memset(&ifr, 0, sizeof(ifr));
        strncpy(ifr.ifr_name, iface->ifname, sizeof(ifr.ifr_name) - 1);
 
-       if (!ioctl(sock, SIOCGIFMTU, &ifr)) {
+       if (!ioctl(iface->dhcpv4_event.uloop.fd, SIOCGIFMTU, &ifr)) {
                uint16_t mtu = htons(ifr.ifr_mtu);
                dhcpv4_put(&reply, &cursor, DHCPV4_OPT_MTU, 2, &mtu);
        }